package ace.module.account.core.impl.service.authentication;

import ace.cmp.core.model.R;
import ace.module.account.api.model.auth.dto.AuthenticationResult;
import ace.module.account.api.model.auth.input.AuthenticationInputMap;
import ace.module.account.api.model.auth.input.AuthenticationParams;
import ace.module.account.api.model.auth.input.GenericAuthenticationInput;
import jakarta.annotation.Nullable;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;

/**
 * @author caspar
 * @date 2023/3/16 9:27
 */
public interface AuthenticationService {

  <TParams extends AuthenticationParams> R<AuthenticationResult> authentication(
      @Valid @NotEmpty String idOfClient,
      @Valid @NotEmpty Long iamAppId,
      @Valid @NotEmpty String authenticationGrantType,
      @Nullable String tag,
      @Valid TParams bizParams);

  /**
   * @param input {@link GenericAuthenticationInput} json format
   * @return 认证结果
   */
  R<AuthenticationResult> authentication(@Valid @NotEmpty String input);

  /**
   * @param input
   * @return 认证结果
   */
  R<AuthenticationResult> authentication(@Valid @NotNull AuthenticationInputMap input);
}
